$(function(){
	/*默认居住地址信息*/
	$("#province").val( $.cookie("province") );
	$("#city").val( $.cookie("city") );
	$("#county").val( $.cookie("county") );
	$("#township").val( $.cookie("township") );
	$("#village").val( $.cookie("village") );
	$("#gates").val( $.cookie("gates") );
	/*默认居住地址信息*/
	$("#livepatten").append('<option value=' + "0" + '>' + "请选择" + '</option>');
	$.ajax({
		url:"/DataTable/getlivepattenlist",
		type:"post",
		datatype:"json",
		success:function(result){
			console.log(result);
			//添加权限
			for (var i = 0; i < result.livepattenlist.length; i++) {
				$("#livepatten").append
				('<option value=' +result.livepattenlist[i].id+ '>' +result.livepattenlist[i].livepatten + '</option>');
			};
		}
	});
	$("#livingreasons").append('<option value=' + "0" + '>' + "请选择" + '</option>');
	$.ajax({
		url:"/DataTable/getlivingreasonslist",
		type:"post",
		datatype:"json",
		success:function(result){
			console.log(result);
			//添加权限
			for (var i = 0; i < result.livingreasonslist.length; i++) {
				$("#livingreasons").append
				('<option value=' +result.livingreasonslist[i].id+ '>' +result.livingreasonslist[i].livingreasons + '</option>');
			};
		}
	});
	$("#housecategory").append('<option value=' + "0" + '>' + "请选择" + '</option>');
	$.ajax({
		url:"/DataTable/gethousecategorylist",
		type:"post",
		datatype:"json",
		success:function(result){
			console.log(result);
			//添加权限
			for (var i = 0; i < result.housecategorylist.length; i++) {
				$("#housecategory").append
				('<option value=' +result.housecategorylist[i].id+ '>' +result.housecategorylist[i].housecategory + '</option>');
			};
		}
	});
	$("#houseleixing").append('<option value=' + "0" + '>' + "请选择" + '</option>');
	$.ajax({
		url:"/DataTable/gethouseleixinglist",
		type:"post",
		datatype:"json",
		success:function(result){
			console.log(result);
			//添加权限
			for (var i = 0; i < result.houseleixinglist.length; i++) {
				$("#houseleixing").append
				('<option value=' +result.houseleixinglist[i].id+ '>' +result.houseleixinglist[i].houseleixing + '</option>');
			};
		}
	});
	$("#usage").append('<option value=' + "0" + '>' + "请选择" + '</option>');
	$.ajax({
		url:"/DataTable/getusagelist",
		type:"post",
		datatype:"json",
		success:function(result){
			console.log(result);
			//添加权限
			for (var i = 0; i < result.usagelist.length; i++) {
				$("#usage").append
				('<option value=' +result.usagelist[i].id+ '>' +result.usagelist[i].usage + '</option>');
			};
		}
	});
	
	/**
	 * 添加居住信息
	 */
	$("#fromsub").click(function(){
		$.ajax({
			url:"personalInformation/addlive",
			type:"post",
			dataType:"json",
			data:$('#livefrom').serialize(),
			success:function(json){ 
				console.log("添加成功！！");
				//跳转到个人信息页面
                window.location.href="Add_Personal_Information.html";
			},
			error:function(){
				window.location.href="404.html";
			}
		});
	})
})
